<template>
  <div>
    <a-descriptions bordered size='small' :column='3'>
      <a-descriptions-item label='订单编号'>
        {{ orderForm.orderNo }}
      </a-descriptions-item>
      <a-descriptions-item label='制单人'>
        {{ orderForm.nickName }}
      </a-descriptions-item>
      <a-descriptions-item label='制单日期'>
        {{ orderForm.createTime }}
      </a-descriptions-item>
      <a-descriptions-item label='业务编码'>
        {{ orderForm.businessCode }}
      </a-descriptions-item>
      <a-descriptions-item label='区域'>
        {{ orderForm.businessArea }}
      </a-descriptions-item>
      <a-descriptions-item label='部门'>
        {{ orderForm.deptName }}
      </a-descriptions-item>
      <a-descriptions-item label='业务员'>
        {{ orderForm.saleManName }}
      </a-descriptions-item>
      <a-descriptions-item label='发货日期'>
        {{ orderForm.sendDate }}
      </a-descriptions-item>

      <a-descriptions-item label='单位名称'>
        {{ orderForm.customName }}
      </a-descriptions-item>
      <a-descriptions-item label='发货方式'>
        <a-tag color='purple' v-if='orderForm.sendType==1'>现款</a-tag>
        <a-tag color='purple' v-if='orderForm.sendType==2'>预收款</a-tag>
        <a-tag color='purple' v-if='orderForm.sendType==3'>资保金</a-tag>
        <a-tag color='purple' v-if='orderForm.sendType==4'>全额资信</a-tag>
      </a-descriptions-item>

      <a-descriptions-item label='资信方式' v-if='orderForm.sendType==3'>
        <a-tag color='purple' v-if='orderForm.customBondType==1'>底价</a-tag>
        <a-tag color='purple' v-if='orderForm.customBondType==2'>税金</a-tag>
        <a-tag color='purple' v-if='orderForm.customBondType==3'>底价+税金</a-tag>
      </a-descriptions-item>

      <a-descriptions-item label='订单状态'>
        <a-tag color='#87d068' v-if='orderForm.orderState==0'>未提交</a-tag>
        <a-tag color='#87d068' v-if='orderForm.orderState==1'>{{ orderForm.taskName }}</a-tag>
        <a-tag color='#f50' v-if='orderForm.orderState==2'>已审批</a-tag>
      </a-descriptions-item>

      <a-descriptions-item label='收款金额' v-if='orderForm.sendType==1 || orderForm.sendType==3'>
        {{ orderForm.takeAmount }}
      </a-descriptions-item>
      <a-descriptions-item label='收款账户' v-if='orderForm.sendType==1 || orderForm.sendType==3'>
        {{ orderForm.bankName }}
      </a-descriptions-item>
      <a-descriptions-item label='收款日期' v-if='orderForm.sendType==1 || orderForm.sendType==3'>
        {{ orderForm.takeDate }}
      </a-descriptions-item>
      <a-descriptions-item label='附件'>
        <f-images :value='orderForm.orderImage'></f-images>
      </a-descriptions-item>
      <a-descriptions-item label='开票要求'>
        {{ orderForm.invoiceRemark }}
      </a-descriptions-item>
      <a-descriptions-item label='发票号码' v-if='orderForm.invoiceNo'>
        {{ orderForm.invoiceNo }} 开票日期:{{ orderForm.invoiceDate }}
      </a-descriptions-item>
      <a-descriptions-item label='备注'>
        {{ orderForm.remark }}
      </a-descriptions-item>
    </a-descriptions>
    <a-divider orientation='left'>发货信息</a-divider>
    <f-table ref='orderDetails' rowKey='orderDetailsId' :showTotal='true' :tableColumns='orderDetailsColumns' :operator='operator' :params='queryParam' :api='api.hyOrderDetails' :pageSize='80' :autoLoad='false' :showPagination='false' :multiple='false'>

    </f-table>
  </div>
</template>

<script>
import api from "../../../js/api"


export default {
  name: "OrderSearchDetails",
  components: {},
  data() {
    let me = this
    //操作按钮
    let operator = []
    return {
      api: Object.assign(api, this.api),
      //列表初始化查询参数
      queryParam: {},
      processImageVisible: false,
      saleType: "",
      order: {},
      orderForm: {},
      orderDetailsColumns: [],
      operator: operator
    }
  },
  created() {
  },
  computed: {},
  methods: {
    getOrderDetailsColumns() {
      let column = [{
        title: "商品名称",
        align: "center",
        width: "180px",
        ellipsis: true,
        dataIndex: "drugsName"
      }, {
        title: "规格",
        align: "center",
        ellipsis: true,
        width: "140px",
        dataIndex: "drugsSpec"
      }, {
        title: "批号",
        align: "center",
        width: "90px",
        dataIndex: "drugLotNo"
      }, {
        title: "有效期至",
        align: "center",
        width: "80px",
        dataIndex: "expirationDate"
      }, {
        title: "数量",
        align: "center",
        width: "80px",
        dataIndex: "saleNum"
      }, {
        title: "单价",
        align: "center",
        width: "80px",
        dataIndex: "salePrice"
      }, {
        title: "销售金额",
        align: "center",
        needTotal: true,
        width: "90px",
        dataIndex: "saleAmount"
      }, {
        title: "回款金额",
        align: "center",
        width: "80px",
        dataIndex: "returnAmount"
      }, {
        title: "回款日期",
        align: "center",
        width: "80px",
        dataIndex: "returnDate"
      }]
      return column
    },
    setData(data) {
      if (data && data.orderId) {
        let params = {
          orderId: data.orderId,
          handlerName: "hyOrderGetHandler"
        }
        this.http.get(this, {
          url: this.api.hyorder.get,
          params: params,
          success: function(me, data) {
            me.orderForm = data
            me.loaded = true
          }
        })
        this.orderDetailsColumns = this.getOrderDetailsColumns()
        this.queryParam.orderId = data.orderId
        this.order = data
        this.$refs["orderDetails"].refresh(false)
      }
    },

    processImg(order) {
      this.processInstanceId = order.processInstanceId
      this.processImageVisible = true
    }
  }
}
</script>
<style lang='less'>


</style>